<?php
/**
 * Created by PhpStorm.
 * User: jimmy.chen
 * Date: 17/6/1
 * Time: 14:33
 */

require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
use Workerman\WebServer;
use Workerman\Connection\TcpConnection;

$server = new WebServer("http://0.0.0.0:8080");
$server->count = 4;
$server->addRoot("localhost", "../hehe/");

$server->runAll();




die;


$work = new Worker("http://0.0.0.0:8080");

$work->count = 4;
$work->onMessage = function(TcpConnection $conn, $data) {

    $conn->send("ok");
};

$work->runAll();

die;


class zhanhun {

}

$DI = [];

$DI['redis'] = function () {
    $redis = new Redis();
    $redis->connect('127.0.0.1');

    return $redis;
};

$redis = $DI['redis']();


$redis = Closure::bind($DI['redis'], NULL, 'zhanhun');


var_dump($redis()->get('zhanhun'));

die;

$zhanun = new zhanhun();
echo $zhanun->redis();

die;

var_dump($redis->get('zhanhun'));die;


Flight::route('/', function() {
    echo 1;
});

Flight::route('/a', function () {
    $method = Flight::request()->cookies->getData();
    echo $method;
});

Flight::start();
